package com.example.seckill.config;

import com.example.seckill.service.ItemService;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class GuavaConfig {
    @Autowired
    private ItemService itemService;

    @Bean
    public Cache<String,Object> localCache (){
        Cache<String, Object> build = CacheBuilder.newBuilder().initialCapacity(1000)
                .maximumSize(10000).expireAfterAccess(10, TimeUnit.MINUTES)
                .build();
        return build;
    }

 
}